<template>
  <div id="app">
    <div class="content">
      <!--选择部分 开始-->
      <div class="genre">
        <div class="difgenre">
          <span class="left">频道</span>
          <div class="right">
            <ul>
              <li><a href="javascript:void (0)" @click="loadNanList('男频','玄幻')" >男频</a></li>
              <li><a href="javascript:void (0)" @click="loadWomanList('女频','青春校园')">女频</a></li>
            </ul>
          </div>
        </div>
        <div class="difgenre">
          <span class="left">类型</span>
          <div class="right">
            <ul >
              <li v-for="f in LeiBieArr">
                <a href="javascript:void (0)" @click="loadWomanList(f.gender,f.type)">{{f.type}}</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <!--选择部分 结束-->
      <!--展示标题 开始-->
      <div class="showTitle">

      </div>
      <!--展示标题 结束-->
      <!--展示内容 开始-->
      <div class="show">
        <ul class="newShow">
          <li v-for="p in productArr">
            <a href="" target="_blank">
              <img :src="p.url" :alt="p.title">
            </a>
            <div class="bookMation">
              <h3><a href="" target="_blank">{{ p.title }}</a></h3>
              <p class="tryread">{{ p.author }}<a href="" target="_blank">试读</a></p>
              <span>
                <s></s>
                {{ p.sales }}
              </span>
              <p class="introduce">{{ p.content }}</p>
            </div>
          </li>
        </ul>
      </div>

      <div class="changepage">
        <span>
         <a class="up noClick">
           <s></s>
           <i> 上一页</i>
         </a>
          <a class="cur">1</a>
          <a href="">2</a>
          <a href="">3</a>
          <a class="noBg">...</a>
          <a href="" class="down"><i>下一页</i><s></s></a>
        </span>
      </div>
    </div>

  </div>
</template>

<script type="text/javascript">
export default {
  data() {
    return {
      productArr: [
        {
          title: "",
          url: "",
          sales: "",
          content: "",
          author: ""
        }
      ],
      LeiBieArr: [
        {
          type: ""
        }
      ],
      typeNan:{
        gender:"",
        type:""
      }
    }
  },
  created() {
    this.loadWomanList('女频','');
  },
  methods: {
    loadNanList(gender,type) {
      console.log('准备从服务器端加载【男频列表】……');
      let url = 'http://localhost:9080/books/neiron?type='+type;
      console.log(url);
      this.axios
          .get(url)
          .then((response) => {
            let responseBody = response.data;
            console.log('接收到服务器端响应的结果：');
            console.log(responseBody);

            this.productArr = responseBody.data;
          });
      console.log('准备从服务器端加载【男分类列表】……');
      url = 'http://localhost:9080/books/fen?gender='+gender;
      console.log('请求路径：' + url);
      this.axios
          .get(url)
          .then((response) => {
            let responseBody = response.data;
            console.log('接收到服务器端响应的结果：');
            console.log(responseBody);
            this.LeiBieArr = responseBody.data;
          });

    },
    loadWomanList(gender,type) {
      if(gender == undefined){
        gender = '女频';
      }
      console.log('准备从服务器端加载【女频列表】……');
      let url = 'http://localhost:9080/books/neiron?type='+type;
      console.log('请求路径：' + url);
      this.axios
          .get(url)
          .then((response) => {
            let responseBody = response.data;
            console.log('接收到服务器端响应的结果：');
            console.log(responseBody);
            this.productArr = responseBody.data;
          });
      console.log('准备从服务器端加载【女分类列表】……');
      url = 'http://localhost:9080/books/fen?gender='+gender;
      console.log('请求路径：' + url);
      this.axios
          .get(url)
          .then((response) => {
            let responseBody = response.data;
            console.log('接收到服务器端响应的结果：');
            console.log(responseBody);
            this.LeiBieArr = responseBody.data;
          });
    },


    mounted() {
      console.log('mounted');
      this.loadNanList();

      this.loadWomanList();
    }
  }
}
</script>
<style>
li {
  display: list-item;
  text-align: -webkit-match-parent;
}

button {
  margin-bottom: 30px
}

h1, h2, h3, h4, h5, p {
  font-family: "Microsoft Yahei", arial, sans-serif;
}

.showTitle p {
  width: 144px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  float: right;
  letter-spacing: 1px;
}

.aboutcompany a {
  font-size: 12px;
  margin: 0 8px;
}

.aboutcompany .link a {
  font-size: 14px;
}

.aboutcompany .link {
  margin-bottom: 20px;
}

.aboutcompany {
  text-align: center;
  font-size: 12px;
  color: #9e9e9e;
}

.v1_foot {
  height: 345px;
  color: #9e9e9e;
  overflow: hidden;
}

.download .loadLeft s {
  display: block;
  width: 21px;
  height: 23px;
  background-position: -2px -92px;
  margin: 8px auto 0;
}

.download .loadRight s {
  display: block;
  width: 21px;
  height: 26px;
  background-position: -24px -92px;
  margin: 8px auto 0;
}

.v1_foot s {
  float: none;
}

.n1_header s, .v1_foot s, .noLogin .off s {
  background: url(../../src/assets/icon.png) no-repeat;
}

.download .loadLeft, .download .loadRight {
  float: left;
  width: 160px;
  height: 40px;
  border-radius: 5px;
  background: #212121;
}

.download a {
  display: block;
  overflow: hidden;
}

.download .icon {
  float: left;
  width: 40px;
  height: 40px;
  border-right: 1px solid #f7f7f7;
}

.download .explain {
  float: left;
  width: 118px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: #fff;
  font-size: 14px;
}

.download .loadRight {
  float: right;
  background: #4caf50;
}

.download .loadLeft, .download .loadRight {
  width: 160px;
  height: 40px;
  border-radius: 5px;
}

em, h2, h1, h3, i {
  font-style: normal;
  font-weight: normal;
}

element.style {
  margin-top: 0px;
}

.download {
  width: 348px;
  height: 138px;
  background: #e6e6e6;
  border-radius: 10px;
  margin: 40px auto 30px;
  padding: 0 46px;
}

.showTitle p .leftArro s {
  width: 7px;
  height: 11px;
  background-position: 0 -38px;
}

.download h3 {
  font-size: 18px;
  text-align: center;
  color: #212121;
  padding: 22px 0 24px 0;
}

div {
  display: block;
}

body {
  color: #9e9e9e;
  font: 12px/20px "Microsoft Yahei", arial, sans-serif;
  background: #f0f0f0;
  font-weight: normal;
}

.content {
  width: 1000px;
  overflow: hidden;
  margin: 0 auto;
  padding-top: 40px;
}

.content .genre {
  padding: 18px 46px;
  background: #fff;
}

.difgenre {
  overflow: hidden;
}

.difgenre .left {
  float: left;
  width: 48px;
  height: 50px;
  line-height: 50px;
  color: #ccc;
}

.difgenre .right {
  float: left;
  width: 848px;
  padding: 0 0 0 6px;
  border-bottom: 1px solid #f0f0f0;
  overflow: hidden;
}

.difgenre ul {
  width: 790px;
  float: left;
  padding: 6px 0;
}

.difgenre ul li {
  float: left;
  margin-right: 14px;
  padding: 8px 0;
}

.difgenre ul .current a {
  background: #9e9e9e;
  border-radius: 50px;
  color: #fff;
  border: 1px solid #9e9e9e;
  line-height: 18px;
}

.difgenre .right a {
  display: inline-block;
  height: 20px;
  line-height: 20px;
  padding: 0 9px;
  border: 1px solid #fff;
}

.difgenre .right .more {
  float: right;
  margin-top: 14px;
}

em, span {
  display: inline-block;
}

.difgenre .right .more a {
  width: 38px;
  height: 20px;
  border: none;
}

.difgenre .right .more a s {
  float: right;
  width: 9px;
  height: 6px;
  background-position: 0 0;
  margin-top: 7px;
}

.difgenre .right .more a i {
  float: left;
}

.difgenre .right .clickMore {
  display: none;
}

.difgenre .right .clickMore a s {
  background-position: -9px 0;
}

* {
  margin: 0;
  padding: 0;
  list-style: none;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

.blankHead {
  width: 100%;
  height: 68px;
  min-width: 1000px;
}

.n1_header {
  width: 100%;
  height: 68px;
  min-width: 1000px;
  background: #fff;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
}

.n1_header_wrap {
  width: 1000px;
  height: 68px;
  line-height: 68px;
  margin: 0 auto;
  padding: 0 2px;
}

.n1_header_wrap h1 {
  float: left;
  height: 68px;
}

a {
  text-decoration: none;
  outline: none;
  font-family: "Microsoft Yahei", arial, sans-serif;
  color: #9e9e9e;
}

.n1_header_wrap h1 img {
  margin-top: 16px;
  width: 160px;
  height: 32px;
}

.n1_headerR {
  float: right;
  height: 68px;
}

.n1_headerR .n1_nav {
  overflow: hidden;
  float: left;
}

.n1_headerR .n1_nav li {
  height: 50px;
  float: left;
  margin-left: 28px;
}

.n1_headerR .n1_nav li a {
  display: block;
  font-size: 14px;
  color: #9e9e9e;
}

.n1_headerR .n1_nav .current {
  border-bottom: 2px solid #f26552;
}

.n1_search {
  float: left;
  position: relative;
}

.n1_login {
  float: left;
  padding-top: 20px;
}

form {
  display: block;
}

element.style {
  box-shadow: none;
}

.n1_search .list {
  position: absolute;
  right: 20px;
  top: 49px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #f0f0f0;
  display: none;
  z-index: 1;
}

.n1_login_affer {
  width: 108px;
  background: #FFF;
  font-size: 12px;
  color: #9e9e9e;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #d2d2d2;
  overflow: hidden;
  text-align: center;
  display: none;
  position: relative;
  z-index: 1;
}

.n1_login_affer a {
  display: block;
  width: 88px;
  height: 26px;
  line-height: 26px;
  padding: 0 10px;
  color: #9e9e9e;
}

.n1_login_affer ul {
  display: none;
}

.n1_search input:hover {
  border: 1px solid #9e9e9e;
}

n1_search s {
  width: 15px;
  height: 15px;
  cursor: pointer;
  position: absolute;
  right: 36px;
  top: 27px;
}

.changepage .down i {
  margin-left: 14px;
  float: left;
}

.changepage .down s {
  background-position: 0 -50px;
  margin-left: 8px;
}

.changepage .down {
  color: #e5e5e5;
}

.changepage .noClick s {
  background-position: -9px -9px;
}

.changepage a s {
  float: left;
  width: 7px;
  height: 11px;
  background-position: 0 -38px;
  margin: 12px 8px 0 14px;
}

.n1_search input {
  width: 160px;
  height: 28px;
  line-height: 28px;
  border: 1px solid #d2d2d2;
  border-radius: 50px;
  margin: 0 22px 0 20px;
  color: #9e9e9e;
  padding: 0 36px 0 12px;
  font-size: 12px;
}

.n1_login span {
  width: 58px;
  height: 26px;
  line-height: 26px;
  background: #FFF;
  text-align: center;
  font-size: 12px;
  color: #9e9e9e;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #d2d2d2;
  display: block;
}

.showTitle {
  width: 1000px;
  height: 41px;
  padding-top: 23px;
}

.showTitle .current {
  background: #fff;
  height: 41px;
}

.showTitle span a {
  display: block;
  overflow: hidden;
}

.showTitle .hot, .showTitle .new, .showTitle .comment {
  float: left;
  width: 114px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 3px;
  background: #f5f5f5;
  font-size: 14px;
}

.showTitle .new {
  margin: 0 1px;
}

.showTitle p a {
  float: left;
  width: 32px;
  height: 34px;
  line-height: 36px;
  text-align: center;
  border: 1px solid #f0f0f0;
  background: #fff;
  border-radius: 3px;
}

.showTitle p i {
  margin: 0 2px;
}

.showTitle p .rightArro {
  float: right;
}

.showTitle p .rightArro s {
  width: 7px;
  height: 11px;
  background-position: 0 -50px;
}

.showTitle p a s {
  display: inline-block;
}

.showTitle p a:hover {
  border: 1px solid #d2d2d2;
}

.content a:hover {
  color: #9e9e9e;
}

.show {
  width: 930px;
  overflow: hidden;
  background: #fff;
  padding: 42px 35px 0;
}

.show .newShow {
  display: block;
}

.show ul {
  overflow: hidden;
}

.show ul li {
  padding: 0 20px;
  margin-bottom: 44px;
  overflow: hidden;
  float: left;
}

.show .bookMation {
  width: 148px;
  float: left;
  text-align: left;
}

.show ul li img {
  float: left;
  width: 105px;
  height: 140px;
  border: 1px solid #f0f0f0;
  margin-right: 14px;
}

.show .bookMation h3 {
  height: 27px;
  width: 148px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #212121;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.show .bookMation h3 a {
  color: #212121;
}

.show .bookMation .tryread a {
  width: 34px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  color: #fff;
  border-radius: 3px;
  float: right;
  background: #f26552;
}

.show .bookMation s {
  float: left;
  width: 14px;
  height: 9px;
  background: url('../../src/assets/icon.png') no-repeat -86px -73px;
  margin: 6px 6px 14px 0;
}

.show .bookMation .introduce {
  width: 148px;
  height: 48px;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-top: 8px;
}

.changepage {
  height: 36px;
  padding-top: 22px;
  text-align: center;
}

.changepage .noClick {
  color: #e5e5e5;
}

.content s {
}

.changepage .cur {
  background: #e0e0e0;
  border: 1px solid #e0e0e0;
  color: #fff;
}

.changepage a {
  float: left;
  width: 33px;
  height: 33px;
  line-height: 34px;
  text-align: center;
  background: #fff;
  border-radius: 3px;
  margin: 0 8px;
  cursor: pointer;
  border: 1px solid #fff;
}

.changepage .noBg {
  background: none;
  line-height: 30px;
  border: none;
}

.changepage .up, .changepage .down {
  width: 80px;
  height: 34px;
  text-align: left;
}
</style>


